package service.impl;

import dao.NewsUserDao;
import dao.impl.NewsUserDaoImpl;
import pojo.NewsUser;
import service.NewsUserService;
import util.MD5Util;

public class NewsUserServiceImpl implements NewsUserService {
    private NewsUserDao newsUserDao =new NewsUserDaoImpl();
    @Override
    public NewsUser findByUsername(String username) {
        return newsUserDao.findByUserName(username);
    }

    @Override
    public NewsUser findByUid(Integer uid) {
        return newsUserDao.findByUid(uid);
    }

    @Override
    public Integer registUser(NewsUser registUser) {
// 密码明文转密文
        registUser.setUserPwd(MD5Util.encrypt(registUser.getUserPwd()));
        // 存入数据库
        return newsUserDao.insertNewsUser(registUser);
    }
}
